package com.marchsoft.group.manager.system.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.api.R;
import com.marchsoft.group.manager.common.response.Result;
import com.marchsoft.group.manager.common.utils.SecurityUtils;
import com.marchsoft.group.manager.system.entity.Student;
import com.marchsoft.group.manager.system.entity.User;
import com.marchsoft.group.manager.system.service.IStudentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ZhangHaoQi
 * @since 2020-12-20
 */
@Api(tags = "学生信息")
@RestController
@RequestMapping("/api/student")
public class StudentController {

    @Autowired
    IStudentService studentService;


    /**
     * fetch
     * @Author zhanghaoqi
     * @Description 获取所有的学生信息
     * @Data 20:48 2021/1/18
     * @param
     * @return com.marchsoft.group.manager.common.response.Result
     */
    @GetMapping("/all")
    @PreAuthorize("hasAuthority('super_admin')")
    public Result getUser(){
        System.out.println("啦啦啦啦");
        List<Student> allStudents = studentService.getAllStudents();
        return  Result.success(allStudents);


    }
}

